package com.xbongbong.pro.statistic.result.pojo;

import com.xbongbong.paas.toolbox.util.StringUtil;
import java.io.Serializable;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 处理聚合结果内的buckets后的格式
 * @author zcp
 * @version v1.0
 * @date 2019/2/19 19:46
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class AggsBucketsPojo implements Serializable {
    private static final long serialVersionUID = 1302206070716716334L;

    /**
     * 聚合的key
     */
    private String key;
    /**
     * 聚合后桶内的值
     */
    private String value;
    /**
     * 聚合后桶内的值（列表）
     */
    private List<String> valueList;

    public AggsBucketsPojo() {
    }

    public AggsBucketsPojo(String key, String value) {
        this.key = key;
        value = StringUtil.isEmpty(value) ? "0" : value;
        this.value = value;
    }

    public AggsBucketsPojo(String key, List<String> valueList) {
        this.key = key;
        this.valueList = valueList;
    }
}
